
<!--
All rights Reserved, Designed By www.youyacao.com
@Description:短信配置
@author:成都市一颗优雅草科技有限公司
@version V4.2
注意：本前端源码遵循 MIT开源协议本内容仅限于个人参考，禁止用于其他的商业用途
需要商业用途或者定制开发等可访问songshu.youyacao.com   联系QQ:422108995 23625059584
开源gitee地址：https://gitee.com/youyacao/songshu-video-page
 -->


<template>
  <div>
    <div class="crumbs">
      <el-breadcrumb separator="/">
        <el-breadcrumb-item>
          <i class="el-icon-lx-calendar"></i> 站点配置
        </el-breadcrumb-item>
        <el-breadcrumb-item>短信配置</el-breadcrumb-item>
      </el-breadcrumb>
    </div>
    <div class="container">
      <div class="form-box">
        <el-form ref="form" :model="form" label-width="200px">
          <el-form-item>
			  
			  
			  <el-row>
			    腾讯云服务：
			    <el-link
			      :href="'https://partners.cloud.tencent.com/invitation/1000009941225fd73659498d2'"
			      type="primary"
			      target="_blank"
			    >https://partners.cloud.tencent.com/</el-link>
			  </el-row>
            <el-row>
              叮咚云服务(默认)：
              <el-link
                :href="'http://www.dingdongcloud.com'"
                type="primary"
                target="_blank"
              >http://www.dingdongcloud.com</el-link>
            </el-row>
            <el-row>
              赛邮云服务：
              <el-link
                :href="'https://www.mysubmail.com/'"
                type="primary"
                target="_blank"
              >https://www.mysubmail.com/</el-link>
            </el-row>
         
          </el-form-item>

          <el-form-item label="API服务商" prop="region">
            <el-select v-model="form.sms_server" placeholder="请选择服务商">
              <el-option label="叮咚云" value="dingdong"></el-option>
              <el-option label="赛邮云" value="mysubmail"></el-option>
              <el-option label="腾讯云" value="tencent"></el-option>
            </el-select>
          </el-form-item>

          <el-form-item label="叮咚APIKEY">
            <el-input v-model="form.sms_apikey"></el-input>
          </el-form-item>
          <el-form-item label="赛邮云APPID配置">
            <el-input v-model="form.mysubmail_sms_appid"></el-input>
          </el-form-item>
          <el-form-item label="赛邮云APIKEY">
            <el-input v-model="form.mysubmail_sms_apikey"></el-input>
          </el-form-item>
          <el-form-item label="腾讯云APPID配置">
            <el-input v-model="form.tencent_sms_appid"></el-input>
          </el-form-item>
          <el-form-item label="腾讯云APIKEY">
            <el-input v-model="form.tencent_sms_apikey"></el-input>
          </el-form-item>
          <el-form-item label="短信模板配置">
            <el-input v-model="form.sms_template" placeholder="如：【优雅草】您的验证码是：{验证码}，请在10分钟内输入。请勿告诉其他人。"></el-input>
          </el-form-item>
          <el-form-item label="短信发送间隔时间(毫秒)">
            <el-input v-model="form.sms_sleep_time"></el-input>
          </el-form-item>
          <el-form-item label="短信有效时间(毫秒)">
            <el-input v-model="form.sms_life_time"></el-input>
          </el-form-item>
          <el-form-item :label="'最大错误次数(防止暴力破解)'">
            <el-input v-model="form.sms_err_count"></el-input>
          </el-form-item>
          <el-form-item>
            <el-button type="primary" @click="onSubmit">提交</el-button>
            <el-button>取消</el-button>
          </el-form-item>
        </el-form>
      </div>
    </div>
  </div>
</template>

<script>
import qs from 'Qs'
export default {
  name: 'baseform',
  data () {
    return {
      form: {}
    }
  },
  created () {
    this.getData()
  },
  methods: {
    getData () {
      this.$api.config.get({}).then(res => {
        this.form = res.data
      })
    },
    onSubmit () {
      var data = []
      for (let item in this.form) {
        data[`config[${item}]`] = this.form[item]
      }
      console.log(data)
      this.$api.config.set(qs.stringify(data)).then(res => {
        console.log(res.data)
      })
      this.$message.success('提交成功！')
    }
  }
}
</script>
